package com.weu.service.impl;

import com.weu.bean.Result;
import com.weu.bean.Series;
import com.weu.mapper.SeriesMapper;
import com.weu.service.ISeriesService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class SeriesServiceImpl implements ISeriesService {

    @Resource
    private SeriesMapper seriesMapper;

    @Override
    public List<Series> getAll() {
        return seriesMapper.getAll();
    }

    @Override
    public Series getOne(int id) {
        return seriesMapper.getOne(id);
    }

    @Override
    public Result getSeries(int typeId, int brandId) {
        Result result = new Result();
        result.setSuccess(true);
        result.setMsg("获取系列数据成功");
        List<Series> seriesList = seriesMapper.getSeries(typeId, brandId);
        result.setDetail(seriesList);
        return result;
    }

    @Override
    public int delById(int id) {
        return seriesMapper.delById(id);
    }

    @Override
    public int updateSeries(Series series) {
        return seriesMapper.updateSeries(series);
    }

    @Override
    public int saveSeries(Series series) {
        return seriesMapper.saveSeries(series);
    }
}
